<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>卡券管理</title>
    <link href="{:C('WEB_URL')}Public/admin/style/base.css" rel="stylesheet" type="text/css" />
    <link href="{:C('WEB_URL')}Public/admin/style/master.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="{:C('WEB_URL')}Public/admin/js/jquery1.9.1.js"></script>
    <script type="text/javascript" src="{:C('WEB_URL')}Public/admin/js/base.js"></script>
    <script>
        function del(id){
            if(confirm('确定要删除记录吗?')){
                var url="__URL__/del/coupon_id/"+id;
               // alert(url);
				$.getJSON(url,function(data){
                    if(data['status']==1){
                        $(".list > tbody").children("#J_list"+data['data']).remove();
                    }else{
                        alert(data['info']);
                    }
                })
            }
        }
        
        function accept(id){
            if(confirm('确定要通过记录吗?')){
                var url="__URL__/accept/coupon_id/"+id;
               // alert(url);
				$.getJSON(url,function(data){
                    if(data['status']==1){
                    	alert(data['info']);
                    }else{
                        alert(data['info']);
                    }
                })
            }
        }
        
        
        function reject(id){
            if(confirm('确定要拒接记录吗?')){
                var url="__URL__/reject/coupon_id/"+id;
               // alert(url);
				$.getJSON(url,function(data){
                    if(data['status']==1){
                    	alert(data['info']);
                    }else{
                        alert(data['info']);
                    }
                })
            }
        }
        
        
        
        function used(id){
            if(confirm('确定要启用记录吗?')){
                var url="__URL__/used/coupon_id/"+id;
               // alert(url);
				$.getJSON(url,function(data){
                    if(data['status']==1){
                    	alert(data['info']);
                    	
                    }else{
                        alert(data['info']);
                    }
                    
                    location.reload() ;
                })
            }
        }
        
        function unused(id){
            if(confirm('确定要禁用记录吗?')){
                var url="__URL__/unused/coupon_id/"+id;
               // alert(url);
				$.getJSON(url,function(data){
                    if(data['status']==1){
                       // $(".list > tbody").children("#J_list"+data['data']).remove();
                        alert(data['info']);
                    }else{
                        alert(data['info']);
                    }
                    location.reload() ;
                })
            }
        }
        
    
        function edit(id){
            if(confirm('确定要通过修改吗?')){
                var url="__URL__/edit/coupon_id/"+id;
               // alert(url);
				$.getJSON(url,function(data){
                    if(data['status']==1){
                       // $(".list > tbody").children("#J_list"+data['data']).remove();
                        alert(data['info']);
                    }else{
                        alert(data['info']);
                    }
                    location.reload() ;
                })
            }
        }
        
        
    </script>
	<style type="text/css">
	.box-info{position:absolute;top:0px;bottom:0;right:0px;left:0px;border:1px solid red;background-color:rgba(144,144,145,0.5);display:none}
	.UE img{height:30px;};
	</style>
</head>
<body>
<body>
    <div id="wrapper">
        <h2>卡券管理<a href="{:U('edit')}" class="but_add">添加</a></h2>
        <table class="list">
            <thead>
			<!--筛选-->
		<form action="{:U('index')}" method="post" enctype="multipart/form-data">
        
			卡券名称:<input type='text' class='inputText' name='coupon_name' value="{$_REQUEST['coupon_name']}"/>
			
			
			所属商家:<select name='business_id' style="width:150px;">
							
                            <volist name="b_list" id="vo">
                            
							<option
							
							<?php if($data['business_id']==$vo['business_id']){echo 'selected';} ?> 
							
							value="{$vo['business_id']}">{$vo['business_name']}
							
							</option> 
							
							

                            </volist>
							</select> 
							
							
			<input type='submit' value='搜索' class='btnOrange'>
			
			
		</form>
                <tr>
					<th>卡券ID</th>
					<th>卡券名称</th>
					<th>商场名称</th>
				
					<th>操作</th>
                </tr>
            </thead>
            <tbody>
            <volist name='list' id='vo'>
                <tr align="center" id="J_list{$vo['coupon_id']}">
                    <td>{$vo['coupon_id']}</td>
                    <td>{$vo['coupon_name']}</td>
                    <td>{$vo['business_name']}</td>
                 
                 
                        
                         <td>
                  
                  <!-- 1.审核中2 已审核通过 3驳回 4禁用 -->
                  
                                  <?php if($vo['status']==1){ ?>

                                 
                                 <span class="del" onClick="accept({$vo['coupon_id']})">通过</span>
                                 
                                 <span class="del" onClick="reject({$vo['coupon_id']})">不通过</span>
                                 
                                  <a href="{:U('edit',array('coupon_id'=>$vo['coupon_id'] , 'nowPage'  =>$nowPage  ))}" class="edit" >查看详情</a>
                                 
                                 
                                 <?php   }?>
                           
                    
                                        <?php if($vo['status']==2){ ?>

                                 
                                 <span class="del" onClick="unused({$vo['coupon_id']})">禁用</span>
                                  <a href="{:U('edit',array('coupon_id'=>$vo['coupon_id'] , 'nowPage'  =>$nowPage  ))}" class="edit" >查看详情</a>
                           
                                 
                                 <?php   }?>
                           
                     
                     
                             <?php if($vo['status']==3){ ?>

                                 <a href="{:U('edit',array('coupon_id'=>$vo['coupon_id'] , 'nowPage'  =>$nowPage  ))}" class="edit" >查看详情</a>
                              
                                 
                                 
                           <?php   }?>
                           
                           
                                       <?php if($vo['status']==4){ ?>

                                 
                                 <span class="del" onClick="used({$vo['coupon_id']})">启用</span>
                                 <a href="{:U('edit',array('coupon_id'=>$vo['coupon_id'] , 'nowPage'  =>$nowPage  ))}" class="edit" >查看详情</a>
                           
                                 
                                 <?php   }?>
                           
 								<span class="del" onClick="edit({$vo['coupon_id']})">通过修改</span>

  
                         
<!--                         <a href="{:U('edit',array('coupon_id'=>$vo['coupon_id'] , 'nowPage'  =>$nowPage  ))}" class="edit" >编辑</a>
                        <span class="del" onClick="del({$vo['coupon_id']})">删除</span> -->
                        
                    </td > 	
                    
                    
                </tr>
            </volist>
            </tbody>
        </table>
        <p class="hr_10"></p>
        <div class="pages">{$page} </div>
    </div>
	
	<div class='box-info'>
	</div>
<script type="text/javascript">
	  $(document).on("click","a.J_itemDel",function(){
                $(this).parent("li").remove();
            })
</script>
</body>
</html>